#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>

using namespace std;

int numberOfArithmeticSlices(const vector<int>& nums) {
    int n = nums.size();
    vector<int> dp(n + 10, 0);
    int sum = 0;
    for (int i = 3; i <= n; ++i)
    {
        int a = nums[i - 3], b = nums[i - 2], c = nums[i - 1];
        dp[i] = (b - a) == (c - b) ? dp[i - 1] + 1 : 0;
        sum += dp[i];
    }

    return sum;
}

int main()
{
    numberOfArithmeticSlices({ 1,2,3,4 });
	return 0;
}